package com.wthink.newMain.login

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.wthink.hzgj.data.Result
import com.wthink.hzgj.data.domain.User
import com.wthink.hzgj.service.DevService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

class LoginViewModel : ViewModel() {

    val now = MutableLiveData("")

    fun login(admin: String, pwd: String,success:()->Unit){
        viewModelScope.launch(Dispatchers.IO) {
            val ret = DevService.setUser(User(0,admin),pwd,"log_in")
            if (ret is Result.Success) {
                success()
            }
        }
    }
}